package controller;

import java.util.Collection;
import java.util.Hashtable;
import java.util.Observable;

import model.Register;

public class CodeController extends Observable {
	private MemoryController memoryController = MemoryController.getInstance();

	private static CodeController instance;

	private CodeController() {

	}

	public static CodeController getInstance() {
		if (instance == null) {
			instance = new CodeController();
		}
		return instance;
	}

	public void setCode(Hashtable<Integer, String> code,
			Hashtable<Integer, String> labels) {
		Collection<Register> register = Parser.getParser().parse(code, labels);
		memoryController.setRegister(register);
		setChanged();
		notifyObservers();
	}

}
